home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000104_icon-group-sender _Fri May 14 20:08:19 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
4KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 18 May 1993 18:05:21 MST
Received: by owl.cs.arizona.edu; Tue, 18 May 1993 18:05:20 MST
Date: 14 May 93 20:08:19 GMT
From: dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!ux1.cso.uiuc.edu!uwm.edu!csd4.csd.uwm.edu!corre@ucbvax.Berkeley.EDU (Alan D Corre)
Organization: Computing Services Division, University of Wisconsin - Milwaukee
Subject: Grade Program with LaTeX
Message-Id: <1t0u7jINNivi@uwm.edu>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Since I am retiring this month, I am clearing away things I no longer need,
both tangible and electronic. I thought some of you might be able to use
the ideas in the following little grade calculation program, which has as
its output a LaTeX input file. This is then submitted to the LaTeX processor
which produces a nice looking table. It would be possible to enter the
information from a file, to sort the resulting table by number and add other
bells and whistles. (I use just the last four digits of the social security
number.) Probably your fancy word processor can do an equally good or better
job. But it might spark some ideas. As King Solomon said: Iron sharpens
iron, and a man sharpens the countenance of his friend. I guess that's what
the net is all about.
***
procedure main()
printinfo(getinfo())
end
procedure getinfo()
local infolist, socsec
infolist := []
writes("Number of course? ")
put(infolist,read())
writes("Section of course? ")
put(infolist,read())
writes("Date of course? ")
put(infolist,read())
writes("Enter Social Security Number. Period to finish. ")
while (socsec := read()) ~== "." do {
put(infolist,socsec)
writes("First Exam? ")
#enter a question mark if grade is unknown
put(infolist,read())
writes("Second Exam? ")
put(infolist,read())
writes("Third Exam? ")
put(infolist,read())
writes("Enter Social Security Number. Period to finish. ")}
return infolist
end
procedure printinfo(i)
local outfile, n,total,flag
n := 3
outfile := open(i[1] || i[2] || i[3] || ".tex","w")
write(outfile,"\\documentstyle{article}")
write(outfile,"\\begin{document}")
write(outfile,"\\begin{center}")
write(outfile,"Course Number ",i[1]," Section ",i[2]," \\\\[.25in]")
write(outfile,"Semester ",i[3]," \\\\[.25in]")
write(outfile,"\\begin{tabular}{|c|c|c|c|c|c|} \\hline")
write(outfile,"S.S. & I & II & III & Total & Grade \\\\ \\hline")
while n < *i do {
total := 0
flag := &null
writes(outfile,i[n +:= 1]," & ")
every 1 to 3 do {
writes(outfile,i[n +:= 1]," & ")
if i[n] == "?" then flag := 1
if /flag then total +:= i[n]}
if /flag then writes(outfile," ",total)
writes(outfile," & ")
if /flag then write (outfile,grade(total), " \\\\ \\hline") else
write(outfile,"I \\\\ \\hline")}
write(outfile,"\\end{tabular}")
write(outfile,"\\end{center}")
write(outfile,"\\end{document}")
return
end
procedure grade(n)
local g
n := integer(n + 0.5)
if n >= 63 then g := "A" else
if n >= 48 then g := "B" else
if n >= 33 then g := "C" else
if n >= 18 then g := "D" else
g := "F"
return g
end
--
Alan D. Corre
Department of Hebrew Studies
University of Wisconsin-Milwaukee (414) 229-4245
PO Box 413, Milwaukee, WI 53201 corre@csd4.csd.uwm.edu